<div class="row" style="height: 100%">
	<div class="col-md-9 " style="padding-right: 1.4rem; ">
		<div  class="main-search main-border" >
			<form class="" id="mainSearch" >
				<div class="row ptb20 " >
				   <div class="col" style="position:relative;margin-left: 20px;" >
						<select id="_select" class="form-control" onchange="setRuleContent();">
							<option value=""  selected  style="display:none">请选择...</option>
							<option value="1">正式SN</option>
							<option value="2">水司号</option>
						</select>
						<input id="_input" type="text" style=" width: calc(100% - 60px);
						position: absolute;
						left: 18px;
						height: 34px;
						top: 2px;
						border: none;" class="form-control" placeholder="请选择再输入">
				   </div>
					<div class="col">
						<button type="button" class="btn btn-success" onclick="search_from()">搜索</button>
					</div>
				</div>
			</form>
		</div>
		<div class="statistics-box main-border">
			<div class="top row">
				  <div class="col-xs-4 col-md-3 violet" onclick="orderBreak('/order/list','总订单数')"><span></span><p>所有订单数</p></div>
				  <div class="col-xs-4 col-md-3 blue"   onclick="orderBreak('/order/notBeginlist','未开始订单数')"><span></span><p>未开始订单数</p></div>
				  <div class="col-xs-4 col-md-3 orange" onclick="orderBreak('/order/loadinglist','进行中订单数')"><span></span><p>进行中订单数</p></div>
				  <div class="col-xs-4 col-md-3 green"  onclick="orderBreak('/order/oldlist','已完成订单数')"><span></span><p>已完成订单数</p></div>
			</div>
			<div class="botton row" onclick="aaa()" style="background-color: #fff;cursor: pointer;">
				<div class="col-xs-12 col-md-12">
				<span></span><p>今天生产设备数</p></div>
			</div>
		</div>
		<div class="newOrder row" style="background-color: #fff;cursor: pointer;">
				<div class="col-xs-3 col-md-3" style="background-color: #545ca6">
			    	  <div class="orderTitle">最新订单号</div>
				      <div class="orderNumber"><span></span></div>
			    </div>
				<div class="col-xs-4 col-md-4">
					<div class="num" style="background-color: #3D9AD1;cursor: pointer;">
						 <span class="number"></span><p>生产数量</p>
					</div> 
					<div class="num" style="background-color: #39adc4;cursor: pointer;"> 
						<span class="number1"></span><p>工序数量</p>
					</div> 
					<div class="num" style="background-color: #3D9AD1;cursor: pointer;">
						<span class="number2"></span><p>正在生产</p>
					</div> 
					<div class="num" style="background-color: #39adc4;cursor: pointer;">
						<span class="number3"></span><p>已完成</p>
					</div> 
 		        </div>
				<div class="col-xs-5 col-md-5">
			            <div id="bb" style="height:400px;"></div>
				</div>

			</div>
		<div class="chart-box main-border" style="margin-top: 1.4rem;padding-top: 1rem;">
			<div id="aa" style="height:400px;"></div>
		</div>
	</div>
	<div class="col-md-3 main-border">
		<div class="news-box">
			<div class="title"><i class="glyphicon glyphicon-bullhorn"></i>新闻公告</div>
			<div class="body">
				<ul class="time-line">
					<li><time>2019.02.15</time><h5><a>公告1</a></h5></li>
					<li><time>2019.02.15</time><h5><a></a></h5></li>
					<li><time>2019.02.15</time><h5><a></a></h5></li>
					<li><time>2019.02.15</time><h5><a></a></h5></li>
					<li><time>2019.02.15</time><h5><a></a></h5></li>
					<li><time>2019.02.15</time><h5><a></a></h5></li>
					<li><time>2019.02.15</time><h5><a></a></h5></li>
					<li><time>2019.02.15</time><h5><a></a></h5></li>
				</ul>
			</div>
			<div style="clear:both;"></div>
		</div>
		
	</div>
</div>
<script type="text/javascript">
	var myChart1 = echarts.init(document.getElementById('aa'));
	var myChart2 = echarts.init(document.getElementById('bb'));
	$(function(){
		$('.breadcrumb').css('display','none');
	    var arrayData;
		$.ajax({
				 url: "index/todayFinishNum", 
				 type: "post",
				 dataType:"json",
				 success: function(data){
		        $(".botton.row").find("span").text(data.total);
		      }
		  });
		
		$.ajax({
				 url: "index/orderSituation", 
				 type: "post",
				 dataType:"json",
				 success: function(data){
					 if(data.statusCode !== 300){
						$("div.violet").find("span").text(data[0]);
						$("div.blue").find("span").text(data[1]);
						$("div.orange").find("span").text(data[2]);
						$("div.green").find("span").text(data[3]);
					 }
		      }
		  });

		$.ajax({
				 url: "index/getNewOrderInfo", 
				 type: "post",
				 dataType:"json",
				 success: function(data){
		         $("div.orderNumber").text(data.orderId);
		         $(".number").text(data.allNum);
		         $(".number1").text(data.processNum);
		         $(".number2").text(data.productingNum);
		         $(".number3").text(data.finishNum);
		         // $("div.green").find("span").text(data[2]);
		      }
		  });

         $.ajax({
				 url: "index/statisticsOneMonth", 
				 type: "post",
				 dataType:"json",
				 success: function(data){
		         arrayData  = data;
		        var option = {
			 title: {
		        text: '30天生产趋势',
		        x:'center' 
		    },
		    color: ['#3398DB'],
		    tooltip : {
		        trigger: 'axis',
		        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
		            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
		        }
		    },
		    //  toolbox: {
		    //     feature: {
		    //         dataView: {show: true, readOnly: false},
		    //         magicType: {show: true, type: ['line', 'bar']},
		    //         restore: {show: true},
		    //         saveAsImage: {show: true}
		    //     }
		    // },
		    grid: {
		        left: '3%',
		        right: '4%',
		        bottom: '3%',
		        containLabel: true
		    },
		    xAxis : [
		        {
		            type : 'category',
		            // data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
		            // data : ["2019-02-27", "2019-02-28", "2019-03-01", "2019-03-02", "2019-03-03"],
		            data :arrayData.dates,
		            axisPointer:{type:'shadow'},
		            axisTick: {
		                alignWithLabel: true
		            }
		        }
		    ],
		    yAxis : [
		        {
		            type : 'value'
		        }
		    ],
		    series : [
		        {
		            name:'数量',
		            type:'bar',
		            barWidth: '60%',
		            data:arrayData.nums
		        },
		         {
		            name:'温度',
		            type:'line',
		            barWidth: '60%',
		            // data:[10, 52, 200, 334, 390, 330, 220]
		            data:arrayData.nums
		        }
		    ]
		}; 
		myChart1.setOption(option, true);

		      }
		  });
		$.sidenav_width(); 
		

		option2 = {
		    title : {
		        text: '生产计划',
		        // subtext: '纯属虚构',
		        x:'center'
		    },
		    // color:['#ff9c00','#1ab667'],
		    tooltip : {           //鼠标悬浮数值
		        trigger: 'item',
		        formatter: "{a} <br/>{b} : {c} ({d}%)"
		    },
		    // legend: {
		    //     orient: 'vertical',
		    //     left: 'left',
		    //     data: ['直接访问','邮件营销']
		    // },
		    series : [
		        {
		            name: '生产详情',
		            type: 'pie',
		            radius : '55%',
		            center: ['50%', '60%'],
		            data:[
		                {value:335, name:'生产数量'},
		                {value:310, name:'已完成'}
		            ],
		            itemStyle: {
		                emphasis: {
		                    shadowBlur: 10,
		                    shadowOffsetX: 0,
		                    shadowColor: 'rgba(0, 0, 0, 0.5)'
		                }
		            }
		        }
		    ]
		};
		myChart2.setOption(option2, true);
		
	})

	window.onresize=function(){
        $('#aa').width($('#aa').parent().width());
            myChart1.resize(); 
            myChart2.resize(); 
    }

    function aaa(){
		    Ewin.dialog({
		        id:'todayDevice',
		        url:'/order/list/todayDevice',
		        title:'今天生产设备数',
		        width:800,
		        height:600
		    })
    };

	function search_from(){
		let $select = $('#_select').val();
		let $input = $('#_input').val();
		$select == ''? toastr.warning('请选择选项!'): '';
		$input == ''? toastr.warning('输入不能为空!'): '';
		if($select != '' && $input != ''){
			$('.content-container').ajaxUrl({'url':'/device/newPage','data':{'type':$select,'searchString':$input},'type':'post'});
		}
	}
	function setRuleContent(){
        var selectValue = $('#_select option:selected').text();//选中select的内容
		$("#_input").val('');
		var inputValue = $("#_input").attr("placeholder",'请输入'+selectValue);//input获得select的内容并显示在输入框中
	};

   function orderBreak(url,name){ //mian页面跳转专用
		if(orderBool){
			$('.content-container').ajaxUrl({url});
			$('.breadcrumb').replaceWith('<ol class="breadcrumb"><li class="breadcrumb-item">订单</li><li class="breadcrumb-item open" aria-current="page"><a href="'+url+'">'+name+'</a></li></ol>')
		}else{
			toastr.warning('您没有权限访问!'); 
		}
   }

</script>